home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / gnu / dld-3_23.lha / dld-3.2.3 / get_symbol.c < prev    next >
C/C++ Source or Header  |  1991-05-30  |  1KB  |  47 lines

  1. /* get_symbol.c -- return the address of the given symbol. */
  2.  
  3. /* This file is part of DLD, a dynamic link/unlink editor for C.
  4.    
  5.    Copyright (C) 1990 by W. Wilson Ho.
  6.  
  7.    The author can be reached electronically by how@cs.ucdavis.edu or
  8.    through physical mail at:
  9.  
  10.    W. Wilson Ho
  11.    Division of Computer Science
  12.    University of California at Davis
  13.    Davis, CA 95616
  14.  */
  15.  
  16. /* This program is free software; you can redistribute it and/or modify it
  17.    under the terms of the GNU General Public License as published by the
  18.    Free Software Foundation; either version 1, or (at your option) any
  19.    later version. */
  20.  
  21. #include "defs.h"
  22.  
  23.  
  24. /* given a symbol name, return the location of that symbol (in core) */
  25. unsigned long
  26. dld_get_symbol (name)
  27. char name[];
  28. {
  29.     register char *p;
  30.     register unsigned long value;
  31.  
  32.     if (name == 0)
  33.     return 0;
  34.  
  35.     if (setjmp (_dld_env))
  36.     return 0;
  37.  
  38.     /* prepend a '_' to name, as required by C's convention */
  39.     p = (char *) _dld_malloc (strlen(name) + 2);
  40.     *p = '_';
  41.     strcpy (p+1, name);
  42.  
  43.     value = dld_get_bare_symbol (p);
  44.     free (p);
  45.     return value;
  46. } /* dld_get_symbol */
  47.